package algorithm.questions;

public class Coin100 {
	public static void count(int num, int alterNum, int interval) {
		Node[] x = new Node[num];
		for (int i = 0; i < num; i++) {
			x[i] = new Node();
			x[i].sides = true;
			x[i].tab = i + 1;
		}
		for (int i = 0; i < num; i++) {
			if (i == 99)
				x[i].next = x[0];
			else
				x[i].next = x[i + 1];
		}
		Node a = x[interval];
		for (int i = 0; i < alterNum; i++) {
			if (a.sides)
				a.sides = false;
			else
				a.sides = true;
			a = a.next.next.next;
		}
		int trueNum = 0;
		for (int i = 0; i < num; i++)
			if (x[i].sides)
				trueNum++;
		System.out.println("���泯�ϵĸ���Ϊ" + trueNum + "��");
	}

	public static void main(String[] args) {
		count(100, 100, 2);
	}

}

class Node {
	int tab;
	boolean sides;
	Node next;
}
